
# 生成器表达式的语法跟列表推导式几乎一样，只是把方括号[]换成了圆括号()。
from faker import Faker
import datetime
fk = Faker('zh_CN')

print(datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S.%f")[:-1])
persons = [(fk.name(), fk.random_int(10, 150), fk.random_int(140, 200)) for _ in range(100)]
print(datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S.%f")[:-1])
persons_new = ((fk.name(), fk.random_int(10, 150), fk.random_int(140, 200)) for _ in range(100))
print(datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S.%f")[:-1])
print(type(persons))
print(datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S.%f")[:-1])
print(type(persons_new))
print(datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S.%f")[:-1])
for p in persons:
    print(p)
print(datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S.%f")[:-1])
for p in persons_new:
    print(p)
print(datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S.%f")[:-1])
############################
d1 = {x: x ** 2 for x in range(10)}
print(d1)

keys = d1.keys()
print(type(keys))
values = d1.values()
print(type(values))
items = d1.items()
print(type(items))
print(keys)
d1[10] = 100
print(keys)